package net.mysoft.budgetsoft.system.action;

import javax.annotation.Resource;

import net.mysoft.budgetsoft.system.pagemodel.FlowTemplate_YeWuZL;
import net.mysoft.budgetsoft.system.service.FlowTemplate_YeWuZLService;
import net.mysoft.framework.base.BaseAction;
import net.mysoft.framework.model.Json;
import net.mysoft.framework.util.ExceptionUtil;

import org.apache.log4j.Logger;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;
import org.springframework.stereotype.Controller;

import com.opensymphony.xwork2.ModelDriven;

/**   
 *  
 * @author dagongPGP v1.0 
 * @link <a href=http://www.dagongsoft.net>北京大公信软科技有限公司</a> 
 *  
 * @version $Revision: 1.00  $Date: 2013-07-23 11:37:31 
 */
@Action(value = "flowTemplate_YeWuZLAction", results = { @Result(name = "flowTemplate_YeWuZL", location = "/platform/system/flowTemplate_YeWuZL.jsp"), @Result(name = "flowTemplate_YeWuZLAdd", location = "/platform/system/flowTemplate_YeWuZLAdd.jsp"), @Result(name = "flowTemplate_YeWuZLEdit", location = "/platform/system/flowTemplate_YeWuZLEdit.jsp"), @Result(name = "flowTemplate_YeWuZLView", location = "/platform/system/flowTemplate_YeWuZLView.jsp")})
@Controller("flowTemplate_YeWuZLAction")
public class FlowTemplate_YeWuZLAction extends BaseAction implements ModelDriven<FlowTemplate_YeWuZL>{

	private static final Logger logger = Logger.getLogger(FlowTemplate_YeWuZLAction.class);
	@Resource
	private FlowTemplate_YeWuZLService flowTemplate_YeWuZLService;
	
	private FlowTemplate_YeWuZL flowTemplate_YeWuZL = new FlowTemplate_YeWuZL();
	
	public FlowTemplate_YeWuZLService getFlowTemplate_YeWuZLService(){
		return this.flowTemplate_YeWuZLService;
	}
	
	public void setFlowTemplate_YeWuZLService(FlowTemplate_YeWuZLService flowTemplate_YeWuZLService){
		this.flowTemplate_YeWuZLService = flowTemplate_YeWuZLService;
	}
	
	public FlowTemplate_YeWuZL getFlowTemplate_YeWuZL(){
		return this.flowTemplate_YeWuZL;
	}
	
	public void setFlowTemplate_YeWuZL(FlowTemplate_YeWuZL flowTemplate_YeWuZL){
		this.flowTemplate_YeWuZL = flowTemplate_YeWuZL;
	}
	
	public FlowTemplate_YeWuZL getModel() {
		return flowTemplate_YeWuZL;
	}
	
	/**
	 * FlowTemplate_YeWuZL列表页面
	 * @return
	 */
	public String flowTemplate_YeWuZL() {
		return "flowTemplate_YeWuZL";
	}
	
	/**
	 * FlowTemplate_YeWuZL查看页面
	 * @return
	 */
	public String flowTemplate_YeWuZLView() {
		return "flowTemplate_YeWuZLView";
	}
	
	/**
	 * FlowTemplate_YeWuZL添加页面
	 * @return
	 */
	public String flowTemplate_YeWuZLAdd() {
		return "flowTemplate_YeWuZLAdd";
	}
	
	/**
	 * FlowTemplate_YeWuZL编辑页面
	 * @return
	 */
	public String flowTemplate_YeWuZLEdit() {
		return "flowTemplate_YeWuZLEdit";
	}
	
	public void setting(){
		try {
			super.writeJson(flowTemplate_YeWuZLService.setting(flowTemplate_YeWuZL));
		} catch (Exception e) {
			logger.error(ExceptionUtil.getExceptionMessage(e));
		}
	}
	/**
	 * 添加
	 */
	public void add() {
		Json j = new Json();
		try {
			flowTemplate_YeWuZLService.add(flowTemplate_YeWuZL);
			j.setSuccess(true);
			j.setMsg("添加成功!");
		} catch (Exception e) {
			logger.error(ExceptionUtil.getExceptionMessage(e));
			j.setMsg("添加失败！");
		}
		super.writeJson(j);
	}
	
	/**
	 * 修改
	 */
	public void edit() {
		Json j = new Json();
		try {
			flowTemplate_YeWuZLService.edit(flowTemplate_YeWuZL);
			j.setSuccess(true);
			j.setMsg("编辑成功!");
		} catch (Exception e) {
			logger.error(ExceptionUtil.getExceptionMessage(e));
			j.setMsg("编辑失败！");
		}
		super.writeJson(j);
	}
	
	/**
	 * 删除
	 */
	public void delete() {
		Json j = new Json();
		try {
			flowTemplate_YeWuZLService.delete(flowTemplate_YeWuZL);
			j.setSuccess(true);
			j.setMsg("删除成功！");
		} catch (Exception e) {
			logger.error(ExceptionUtil.getExceptionMessage(e));
			j.setMsg("删除失败！");
		}
		super.writeJson(j);
	}
	
	/**
	 * 列表
	 */
	public void datagrid() {
		try {
			super.writeJson(flowTemplate_YeWuZLService.datagrid(flowTemplate_YeWuZL));
		} catch (Exception e) {
			logger.error(ExceptionUtil.getExceptionMessage(e));
		}
	}
	
	public void saveList(){
		Json j = new Json();
		try {
			flowTemplate_YeWuZLService.saveList(flowTemplate_YeWuZL);
			j.setSuccess(true);
			j.setMsg("添加成功!");
		} catch (Exception e) {
			logger.error(ExceptionUtil.getExceptionMessage(e));
			j.setMsg("添加失败！");
		}
		super.writeJson(j);
	}
}
